package TEST;

import java.util.Scanner;
import java.util.Set;
import java.util.TreeSet;

public class Main2 {

	public static void main(String[] args) {
		Set<String> words=new TreeSet<>();
		Scanner sc=new Scanner(System.in);
		while(true){
			String word=sc.next();
			if(word.equals("!!!!!")) break;
			words.add(word);
		}
		System.out.println(words.size());
		if(words.size()<=10){
			for(String e:words){
				System.out.println(e);
			}
		}
		else{
			int k=0;
			for(String e:words){
				System.out.println(e);
				k++;
				if(k>=10) break;
			}
		}
		sc.close();
	}

}
